Skip to content

Address intake review follow-ups#346

Merged
michaelmwu merged 2 commits into
mainfrom
michaelmwu/intake-review-followups
Jun 28, 2026
Merged

Address intake review follow-ups#346
michaelmwu merged 2 commits into
mainfrom
michaelmwu/intake-review-followups

Conversation

@michaelmwu

@michaelmwu michaelmwu commented Jun 28, 2026

Copy link
Copy Markdown
Member

Summary

  • Preserve sanitized raw Google Forms intake webhook payloads for audit/debug storage.
  • Avoid retrying resume download/scan after create/update flows already attempted preparation and got no usable file.
  • Add regression coverage for Google raw payload preservation and single-attempt resume preparation failures.

Testing

  • ./scripts/pyrefly.sh --output-format=full-text
  • ./scripts/lint.sh
  • ./scripts/test.sh

Follow-up for review threads from #335:

  • PRRT_kwDOQGJDqs6MzZfQ
  • PRRT_kwDOQGJDqs6MzZfN

Summary by CodeRabbit

  • Bug Fixes
    • Intake submissions now handle attached resume data more reliably, avoiding repeated retry attempts when resume preparation fails.
    • Stored webhook payloads are now cleaned more consistently, including nested data and sensitive URL query strings.
    • Google Forms and Tally intake data now preserve the expected submission details while keeping signed links sanitized in stored raw data.

Copilot AI review requested due to automatic review settings June 28, 2026 13:55
@coderabbitai

coderabbitai Bot commented Jun 28, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@michaelmwu, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 44 minutes and 28 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 451fd060-2f8b-496d-aa50-0ab3507ce727

📥 Commits

Reviewing files that changed from the base of the PR and between 95ffed1 and 7de656c.

📒 Files selected for processing (3)
  • apps/api/src/five08/backend/api.py
  • apps/worker/src/five08/worker/crm/intake_form_processor.py
  • tests/unit/test_backend_api.py
📝 Walkthrough

Walkthrough

Replaces the Tally-specific raw payload sanitizer with a generic _sanitize_intake_raw_payload that strips URL query params from string values. Google Forms intake gains a raw_payload field in enqueued jobs. A sentinel value _RESUME_FILE_NOT_PROVIDED is introduced to prevent duplicate resume preparation when _prepare_resume_file returns None.

Intake Sanitization and Resume Sentinel

Layer / File(s) Summary
Generic intake payload sanitizer and webhook wiring
apps/api/src/five08/backend/api.py
Replaces _sanitize_tally_raw_payload with _sanitize_intake_raw_payload, which recursively normalizes mapping keys to strings, walks lists, and strips URL query params from string values. Google Forms intake adds raw_payload to the enqueued job; Tally intake switches to the same sanitizer.
Resume file sentinel and _build_resume_updates logic
apps/worker/src/five08/worker/crm/intake_form_processor.py
Adds _ResumeFileNotProvided sentinel class and _RESUME_FILE_NOT_PROVIDED constant. Updates _build_intake_updates and _build_resume_updates to resolve prepared_resume_file from the payload only when the sentinel is passed, otherwise using the provided value directly.
Tests for sanitizer contract and resume sentinel
tests/unit/test_backend_api.py, tests/unit/test_intake_form_processor.py
Updates test_google_forms_intake_enqueues_job to assert raw_payload strips URL query params while the normalized resume_url retains them. Adds two tests confirming _prepare_resume_file is invoked exactly once when it returns None, for both create and update prospect paths.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • 508-dev/508-workflows#74: Modifies the Google Forms intake webhook handler and enqueue payload, directly overlapping with the raw_payload and resume_url handling changed here.

Poem

🐇 A sentinel hops in, distinct from None,
No resume retried when the first fetch is done.
URL query params? Stripped from the store,
The raw payload keeps what the job needn't more.
Keys become strings, lists walk in a row—
Clean data flows where webhooks go! 🌿

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 69.23% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the PR’s focus on addressing intake-related review follow-ups.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch michaelmwu/intake-review-followups

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens intake processing across the API and worker to improve audit/debug traceability and avoid redundant resume preparation work, with regression tests to lock in behavior.

Changes:

  • Preserve a sanitized raw_payload for Google Forms intake jobs (and unify raw-payload sanitization for both Google Forms and Tally).
  • Ensure resume download/scan preparation is attempted at most once per create/update flow in the worker.
  • Add unit coverage for raw payload preservation and the single-attempt resume preparation behavior.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
apps/api/src/five08/backend/api.py Adds sanitized raw_payload for Google Forms jobs and unifies intake raw-payload sanitization.
apps/worker/src/five08/worker/crm/intake_form_processor.py Introduces a sentinel to distinguish “not provided” vs explicit None, preventing resume prepare retries.
tests/unit/test_backend_api.py Adds assertions for resume_url passthrough + sanitized raw_payload preservation.
tests/unit/test_intake_form_processor.py Adds regression tests ensuring resume preparation isn’t retried in create/update flows.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +714 to +718
prepared_resume_file: IntakeResumeFile | None
if isinstance(resume_file, _ResumeFileNotProvided):
prepared_resume_file = self._prepare_resume_file(payload)
else:
prepared_resume_file = resume_file

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/api/src/five08/backend/api.py`:
- Around line 822-828: The shared sanitizer in _sanitize_intake_raw_payload
currently strips query strings but still preserves URL fragments, so sensitive
fragment data can be persisted in onboarding_intake_submissions.raw_payload.
Update the URL handling in this sanitizer to remove fragments as well as queries
before storage, and keep the change localized to the shared raw-payload path so
all callers benefit.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b16700bf-1138-499c-8774-dbd2fc37b70f

📥 Commits

Reviewing files that changed from the base of the PR and between f568641 and 95ffed1.

📒 Files selected for processing (4)
  • apps/api/src/five08/backend/api.py
  • apps/worker/src/five08/worker/crm/intake_form_processor.py
  • tests/unit/test_backend_api.py
  • tests/unit/test_intake_form_processor.py

Comment thread apps/api/src/five08/backend/api.py
@michaelmwu
michaelmwu merged commit 80f1c8e into main Jun 28, 2026
11 checks passed
@michaelmwu
michaelmwu deleted the michaelmwu/intake-review-followups branch June 28, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants